package com.example.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class JWTIntercaptorConfig implements WebMvcConfigurer {

  // 拦截路径
  String[] pathPatterns = {
      "/user/**",
      "/author/**",
      "/book_type/**"
  };

  // 忽略路径
  String[] excludePathPatterns = {};

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new WebInterceptor())
        .addPathPatterns(pathPatterns)
        .excludePathPatterns(excludePathPatterns);
  }

}
